<?php

class Core_Form_Admin_Storage_S3 extends Form
{
	function init()
	{
		// admin manage fields

		$this -> addChild('yesno', 'is_active', array(
			'label' => 'Active',
			'required' => true,
			'value' => 1
		));
		
		$this -> addChild('yesno', 'is_default', array(
			'label' => 'Active',
			'required' => true,
			'value' => 1
		));
		
		$this -> addChild('yesno', 'is_locked', array(
			'label' => 'Locked',
			'required' => true,
			'value' => 1
		));
		// other fields for rackspace connect

		$this -> addChild('text', 'key', array(
			'label' => 'Amazon Access Key',
			'required' => true,
			'rules' => array('required'),
			'desc' => 'Amazon access key.'
		));

		$this -> addChild('text', 'secret', array(
			'label' => 'Amazon Secret Key',
			'required' => true,
			'rules' => array('required'),
			'desc' => 'Amazon Secret Key'
		));

		$this -> addChild('text', 'bucket', array(
			'label' => 'Amazon Bucket Name',
			'required' => true,
			'rules' => array('required'),
			'desc' => 'If the bucket does not exist, we will attempt to create it. Please note the following restrictions on bucket names:
-Must start and end with a number or letter
-Must only contain lowercase letters, numbers, and dashes [a-z0-9-]
-Must be between 3 and 255 characters long.'
		));

		$this -> addChild('select', 'region', array(
			'label' => 'Amazon Bucket Name',
			'required' => true,
			'rules' => array('required'),
			'multiOptions' => array(
				'us-west-1' => 'United States (West)',
				'us-east-1' => 'United States (East)',
				'eu-west-1' => 'Europe (Ireland)',
				'ap-southeast-1' => 'Asia Pacific (Singapore)',
				'ap-northeast-1' => 'Asia Pacific (Japan)'
			),
			'desc' => 'This will automatically be created by the script. Leave this setting unless you want to manually create a bucket on Amazon.'
		));

		$this -> addChild('text', 'path_prefix', array(
			'label' => 'Path Prefix',
			'desc' => 'This is prepended to the file path. Defaults to "public".'
		));

		$this -> addChild('text', 'domain', array(
			'label' => 'ClouldFront Domain',
			'desc' => 'If you are using Amazon CloudFront for this bucket, enter the domain here.'
		));

		$this -> addChild('yesno', 'is_active', array('label' => 'is_active'));

		$this -> addChild('group', '_buttons');
		$this -> _buttons -> addChild('submit', '_submit') -> addChild('cancel', '_cancel');
	}

}
